package com.example.mapper;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.example.entity.dto.MoldAllocationHDDto;
import com.example.entity.dto.weixiubaoyang.MoldApplyDto;
import com.example.entity.dto.weixiubaoyang.MoldDto;
import com.example.entity.mysql.MoldAllocationHeader;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.entity.vo.MoldAllocationVo;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.time.LocalDate;
import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author LiangPandeng
 * @since 2024-11-27
 */
public interface MoldAllocationHeaderMapper extends BaseMapper<MoldAllocationHeader> {

    void addMoldAllocation();

    @Update("update mold_allocation_header set completionCode=#{approvalCode} , approvalCode=#{approvalCode} where orderNumber=#{orderNumber} and orderType=#{orderType}")
    Integer updateCode(MoldApplyDto moldApplyDto);

    @Select("SELECT count(*) FROM mold_allocation_header WHERE orderNumber like CONCAT('%',#{now},'%')")
    Integer getNowXjNum(String now);

    List<MoldAllocationHeader> selectHeader(MoldDto moldDto);

    MoldAllocationHDDto headerAndDetail(String orderType, String orderNumber);

}
